package com.sh.high_grade_component.adapter;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager.widget.PagerAdapter;

import com.sh.high_grade_component.entity.GoodsInfo;

import java.util.ArrayList;
import java.util.List;

public class ImagePagerAdapater extends PagerAdapter {

    private Context context;
    private ArrayList<GoodsInfo> mGoodsList;

    private List<ImageView> mViewList = new ArrayList<>();

    public ImagePagerAdapater(Context context, ArrayList<GoodsInfo> mGoodsList) {
        this.context = context;
        this.mGoodsList = mGoodsList;
        for (GoodsInfo goodsInfo : mGoodsList) {
            ImageView imageView = new ImageView(context);
            imageView.setLayoutParams(new ViewGroup.LayoutParams(
                    ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.WRAP_CONTENT
            ));
            imageView.setImageResource(goodsInfo.pic);
            mViewList.add(imageView);
        }
    }


    @Override
    public int getCount() {
        return mGoodsList.size();
    }

    @Override
    public boolean isViewFromObject(@NonNull View view, @NonNull Object object) {
        return false;
    }


    @NonNull
    @Override
    public Object instantiateItem(@NonNull ViewGroup container, int position) {
        return null;
    }

    @Override
    public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {

    }
}
